﻿cmake_minimum_required (VERSION 3.12)
project ("ConstructDesign")

# # Make Visual Studio use utf-8 as source file and execution encoding
# # see https://docs.microsoft.com/zh-cn/cpp/build/reference/utf-8-set-source-and-executable-character-sets-to-utf-8?view=vs-2017
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")

# appending the d for debug libraries
set(CMAKE_DEBUG_POSTFIX d)
add_definitions(-DDEBUG_POSTFIX="d")
add_definitions(-D_WIN32_WINNT=0x0601) # Windows 7
add_definitions(-DGLAPI=WINGDIAPI)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Release)

set(Third_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rd")
set(VSVERSION_ARCH "vs2017-x64")
set(Third_VS_DIR "${Third_DIR}/${VSVERSION_ARCH}")
#set(BOOST_ROOT "${Third_VS_DIR}/Boost" CACHE PATH "boost install directory")
set (QTDIR "C:/Qt/5.12.9/msvc2017_64" CACHE PATH "Qt msvc directory")
set(QtRibbon_DIR "${Third_VS_DIR}/QtitanRibbon" CACHE PATH "Install dir of QtitanRibbon")
set(OSG_DIR "${Third_VS_DIR}/OpenSceneGraph" CACHE PATH "OSG install directory")
set(rapidjson "${Third_DIR}" CACHE PATH "rapidjson include directory")
set(RebarDesignBuild_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../rebar-design/build-workthread" CACHE PATH "RebarDesign build directory")

set(CMAKE_PREFIX_PATH "${QTDIR}/lib/cmake;${CMAKE_PREFIX_PATH}")
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets LinguistTools Svg Concurrent)
find_package(OpenSceneGraph REQUIRED COMPONENTS osgDB osgGA osgUtil osgViewer osgText osgFX)
#find_package(Boost REQUIRED COMPONENTS Log Locale date_time filesystem regex system)

set(CMAKE_MODULE_PATH "${Third_VS_DIR}/Deping;${CMAKE_MODULE_PATH}")
find_package(Log REQUIRED)
find_package(Utility REQUIRED)
find_package(Registry REQUIRED)
find_package(RibbonXML REQUIRED)
find_package(Qt2D REQUIRED)
find_package(QtOSG REQUIRED)
find_package(QtCommand REQUIRED)
find_package(DXF REQUIRED)
find_package(ShxParser REQUIRED)
find_package(Qt2Dxf REQUIRED)
find_package(QtMath REQUIRED)
find_package(OcctUtil REQUIRED)

# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Instruct CMake to run moc automatically when needed
set(CMAKE_AUTOMOC ON)
# Create code from a list of Qt designer ui files
set(CMAKE_AUTOUIC ON)

add_subdirectory(App)

# 设置Visual Studio启动项目
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT App)

